def q_create(size=10):
    q = []
    for _ in range(size):
        q.append(None)
    return {
        'q': q,
        'size': size,
        'rear': 0,
        'front': 0,
    }
    
def q_is_empty(q):
    return q['front'] == q['rear']

def q_is_full(q):
    return (q['rear'] + 1)%q['size'] == q['front']

def q_push(q, element):
    if q_is_full(q):
        return None, 'queue is full'
    q['rear'] = (q['rear'] + 1)%q['size']
    q['q'][q['rear']] = element
    
def q_pop(q):
    if q_is_empty(q):
        return None, 'queue is empty'
    q['front'] = (q['front'] + 1)%q['size']
    return q['q'][q['front']]

def q_popleft(q):
    if q_is_empty(q):
        return None, 'queue is empty'
    q['front'] = (q['front'] + 1) % q['size']
    return q['q'][q['front']]

def q_pushleft(q, element):
    if q_is_full(q):
        return None, 'queue is full'
    q['front'] = (q['front'] - 1) % q['size']
    q['q'][q['front']] = element


